package o;

import android.os.Build.VERSION;
import android.os.StrictMode;
import android.os.StrictMode.ThreadPolicy;
import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;

final class vc {

    class AnonymousClass4 implements FilenameFilter {
        final /* synthetic */ Pattern ॱ;

        AnonymousClass4(Pattern pattern) {
            this.ॱ = pattern;
        }

        public boolean accept(File file, String str) {
            return this.ॱ.matcher(str).matches();
        }
    }

    static int ॱ() {
        int availableProcessors = Runtime.getRuntime().availableProcessors();
        if (VERSION.SDK_INT < 17) {
            return Math.max(ˋ(), availableProcessors);
        }
        return availableProcessors;
    }

    private static int ˋ() {
        File[] listFiles;
        int length;
        ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
        try {
            listFiles = new File("/sys/devices/system/cpu/").listFiles(new AnonymousClass4(Pattern.compile("cpu[0-9]+")));
            StrictMode.setThreadPolicy(allowThreadDiskReads);
        } catch (Throwable th) {
            StrictMode.setThreadPolicy(allowThreadDiskReads);
        }
        if (listFiles != null) {
            length = listFiles.length;
        } else {
            length = 0;
        }
        return Math.max(1, length);
    }
}
